local xuanhua = fk.CreateSkill{
  name = "lvshi__xuanhua",
}

Fk:loadTranslationTable{
  ["lvshi__xuanhua"] = "宣化",
  [":lvshi__xuanhua"] = "其他角色的回合结束后，若你在其攻击范围内，你可进行一次判定，若结果不为此轮判定过的花色，你获得之。",
  ["@lvshi__xuanhua-round"] = "宣化",
  ["#lvshi__xuanhua-invoke"] = "宣化：%src回合结束，你可进行一次判定",

  ["$lvshi__xuanhua1"] = "以道御术，以法灭阵！",
  ["$lvshi__xuanhua2"] = "拦我天工者，天诛之！",
  ["$lvshi__xuanhua3"] = "顺天应命，为我黄天！",
}

xuanhua:addEffect(fk.TurnEnd, {
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(xuanhua.name) and target ~= player and target:inMyAttackRange(player)
  end,
  on_cost = function(self, event, target, player, data)
    return player.room:askToSkillInvoke(player, {
      skill_name = xuanhua.name, prompt = "#lvshi__xuanhua-invoke:"..target.id})
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local judge = {
      who = player,
      reason = self.name,
      pattern = ".",
    }
    room:judge(judge)
    room:delay(500)
    local suits = player:getTableMark("@lvshi__xuanhua-round")
    if not table.contains(suits, judge.card:getSuitString(true)) then
      table.insert(suits, judge.card:getSuitString(true))
      room:obtainCard(player, judge.card, true, fk.ReasonJustMove)
      room:setPlayerMark(player, "@lvshi__xuanhua-round", suits)
    end
  end,
})

return xuanhua